//
// CTile.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CTile {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CTile(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CTile obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CTile(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CTile() {
    this(nel3dJNI.new_CTile(), true);
  }

  public String getRelativeFileName(CTile.TBitmap bitmapType) {
    return nel3dJNI.CTile_getRelativeFileName(swigCPtr, this, bitmapType.swigValue());
  }

  public boolean isFree() {
    return nel3dJNI.CTile_isFree(swigCPtr, this);
  }

  public void serial(IStream f) {
    nel3dJNI.CTile_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void setFileName(CTile.TBitmap bitmapType, String name) {
    nel3dJNI.CTile_setFileName(swigCPtr, this, bitmapType.swigValue(), name);
  }

  public short getRotAlpha() {
    return nel3dJNI.CTile_getRotAlpha(swigCPtr, this);
  }

  public void setRotAlpha(short rot) {
    nel3dJNI.CTile_setRotAlpha(swigCPtr, this, rot);
  }

  public long getGroupFlags() {
    return nel3dJNI.CTile_getGroupFlags(swigCPtr, this);
  }

  public void setGroupFlags(long group) {
    nel3dJNI.CTile_setGroupFlags(swigCPtr, this, group);
  }

  public final static class TBitmap {
    public final static TBitmap diffuse = new TBitmap("diffuse", nel3dJNI.CTile_diffuse_get());
    public final static TBitmap additive = new TBitmap("additive");
    public final static TBitmap alpha = new TBitmap("alpha");
    public final static TBitmap bitmapCount = new TBitmap("bitmapCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TBitmap swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TBitmap.class + " with value " + swigValue);
    }

    private TBitmap(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TBitmap(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TBitmap(String swigName, TBitmap swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TBitmap[] swigValues = { diffuse, additive, alpha, bitmapCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
